from django.contrib import admin
from .models import BookInfo,HeroInfo

# Register your models here.

#class HeroInfoinline(admin.StackedInline):
class HeroInfoInline(admin.TabularInline):
    model = HeroInfo
    extra = 2

class BookInfoAdmin(admin.ModelAdmin):
	list_display = ['pk','btitle','bpub_date']
	list_filter = ['btitle']
	search_fields = ['btitle']
	list_per_page = 1
	#fields = ['bpub_date', 'btitle']
	fieldsets = [
		('basic',{'fields': ['btitle']}),
		('more', {'fields': ['bpub_date']}),
	]
	inlines = [HeroInfoInline]	

class HeroInfoAdmin(admin.ModelAdmin):
	 list_display = ['id', 'hname', 'gender', 'hcontent']


admin.site.register(BookInfo,BookInfoAdmin)
admin.site.register(HeroInfo,HeroInfoAdmin)
